#ifndef QDRIVEMISSION_H
#define QDRIVEMISSION_H

#include "shared_global.h"

#include <QString>
#include <QMap>
#include <QDateTime>

enum    enMissionType
{
    MT_CYCLE,
    MT_TEMP,
    MT_BOTTOM
};

enum    enMissionState
{
    MS_NOTDO,
    MS_DOING,
    MS_DONE,
    MS_DELETE,
    MS_PAUSE,
    MS_BOTTOM
};

enum    enMissionCammand
{
    MC_READ,
    MC_WRITE,
    MC_BOTTOM
};

class SHAREDSHARED_EXPORT QDriveMission
{
public:
    QDriveMission();

    void    setAttribute(const QString &key,const QString &value);
    QString attribute(const QString &key,const QString &def=QString());

    uint    missionID();
    int     valueAddress();
    int     period();
    int     level();
    int     dataLengh();
    int     deviceAddress();
    enMissionType   type();
    QDateTime   lastTime();
    enMissionState missionState();
    enMissionCammand missionCammand();
    ushort  *data();
    int     failedCode();

    void    setMissionID(uint missionID);
    void    setValueAdress(int adress);
    void    setPeriod(int period);
    void    setLevel(int level);
    void    setDataLengh(int lengh);
    void    setDeviceAdress(int adress);
    void    setType(enMissionType type);
    void    setLastTime(const QDateTime &time);
    void    setMissionState(enMissionState state);
    void    setMissionCammand(enMissionCammand cammand);
    void    setData(ushort *us,int len);
    void    setFailedCode(int code);
protected:
    QMap<QString,QString>       m_attribute;

    uint    m_missionID;
    int     m_valueAddress;
    int     m_period;
    int     m_level;
    int     m_dataLengh;
    int     m_deviceAddress;
    enMissionType   m_missionType;
    QDateTime   m_lastTime;
    enMissionState  m_missionState;
    enMissionCammand    m_cammand;
    ushort  m_data[128];
    int     m_failedCode;

};

#endif // QDRIVEMISSION_H
